import java.util.concurrent.*;

/**
 * @ClassName A1
 * @Description
 * @Author Jingxiao.Ye
 * @Date 2021/11/28 下午11:01
 * @Version V1.0
 * @Since JDK 11
 */
public class A1 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //多种线程池
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 2, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
        //ExecutorService executorService = Executors.newSingleThreadExecutor();
//        ExecutorService executorService = Executors.newFixedThreadPool(1);
//        ExecutorService executorService = Executors.newCachedThreadPool();
        Future<Integer> submit = threadPoolExecutor.submit(new Task());
        Integer res = submit.get();
        System.out.println(res);
        threadPoolExecutor.shutdown();
    }
}
